<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Document</title>
        <script src="../js/vue.js"></script>
    </head>
    <body>
        <div id="demo">
            <p>firstName: <input type="text" name="" v-model="firstName"></p>
            <p>lastName: <input type="text" name="" v-model="lastName"></p>
            <p>fullName: {{fullName}}</p>
            <p>fullName: {{fullName}}</p>
            <p>fullName: {{fullName}}</p>
        </div>
        <script>
            new Vue({
                el:'#demo',
                data: {
                    firstName:'zhang',
                    lastName:'san'
                },
                computed:{
                    fullName(){
                        // 计算属性不能进行异步操作
                        // setTimeout(()=>{
                        //     return this.firstName + '+' + this.lastName
                        // },2000)
                        return this.firstName + '+' + this.lastName
                    }
                }
            })
        </script>
    </body>
</html>